home *** CD-ROM | disk | FTP | other *** search
/ Regional Industry Buying Guide: Greater Florida / 2000 Regional Industry Buying Guide - Greater Florida.iso / cs2k / clients / classic / wincim / scripts.lib / cserve.scr < prev    next >
Encoding:
Text File  |  1998-09-30  |  9.2 KB  |  408 lines

  1. !
  2. !  Copyright (c) 1998
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  CSERVE:
  9. !       Connect to CIS.
  10. !       First argument is %TRUE if direct connect and %FALSE otherwise
  11. !       Success:  returns %Success
  12. !       Failure:  saves error msg in %FailureMsg and returns %Failure
  13. !               or %Fatal (depending on severity).
  14. !
  15. !+V
  16. ! "4.0.5"
  17. !-V
  18.  
  19. DirectConnect = Arg1;
  20. Internet = 25;
  21. ifndef %HostName = "CPS";
  22. Plus = "+";
  23. ifndef %WaitForPPP = "1";
  24. Wait_Time = 100;
  25. ifndef %Scanned = "";
  26. Msg = "Connecting to CompuServe Network";
  27. if %Network <> Internet goto NotInternet;
  28. Msg = "Logging onto CompuServe .    ";
  29. define %HostName = "CISAGREE";
  30. Wait_Time = 40;
  31.  
  32. NotInternet:
  33. show Msg;
  34. Tries = 7;
  35. NothingSent = 0;
  36. SecureTries = 3;
  37. FirstTry = %TRUE;
  38. FailStr = "";
  39. Sent_Host_Name = %FALSE;
  40. ifndef %X121Address = "";
  41. ifndef %OKCmd = "";
  42. ifndef %StopAtHost = "";
  43. ifndef %AccountID = "";
  44. ifndef %BreakChar = "#";
  45. ifndef %MicroChallenge = "";
  46. ifndef %App = "";
  47. on cancel goto Return_Cancel;
  48.  
  49. Start_Connect:
  50.     if Tries = 0 goto CIS_Error;
  51.     Tries = Tries - 1;
  52.  
  53. Connect_Wait:
  54.     wait
  55.         "UIC:"          goto Send_ETX,
  56.         "Host Name:"    goto Send_Host_Name,
  57.         "User ID:"      goto Send_ID,
  58.         "Password:"     goto Send_Password,
  59.         "XPAD:"         goto Send_XPAD,
  60.         "ITI:"          goto Send_XPAD,
  61.         "? LOG"         goto Process_Log_Msg,
  62.         "??LOG"         goto Process_Log_Msg,
  63.         "% IPN"         goto Process_IPX_Msg,
  64.         "? IPX"         goto Process_IPX_Msg,
  65.         "? ICD"         goto Process_Net_Msg,
  66.         "??ICD"         goto Process_Net_Msg,
  67.         "RA:"           goto Handle_Secure_Login,
  68.         "0, OFF):"      goto Send_Baud_Rate,
  69.         %mdm_Failure    goto CIS_No_Carrier
  70.     until Wait_Time;
  71.  
  72.     if %Network <> Internet goto Send_Break;
  73.     Wait_Time = 200;
  74.     if not Sent_Host_Name goto Send_CR;
  75.     if NothingSent goto Send_CR;
  76.     NothingSent = 1;
  77.     goto Start_Connect;
  78.  
  79. Send_Break:
  80.     ! Breaks removed, as they caused problems for TAPI
  81.     ! Fall through
  82.  
  83. Send_CR:
  84.     NothingSent = 0;
  85.     send %CR;
  86.     goto Start_Connect;
  87.  
  88. Send_Baud_Rate:
  89.     send %BaudRate;
  90.     send "^M";
  91.     goto Connect_Wait;
  92.  
  93. Send_ETX:
  94.     send "^C";
  95.     goto Connect_Wait;
  96.  
  97. PPPRecover:
  98.     Sent_Host_Name = %FALSE;
  99.  
  100. Send_Host_Name:
  101.     define %State = 5;
  102.     if Arg2 goto No_Wait;
  103.     wait until 10;
  104. No_Wait:
  105.     if Sent_Host_Name goto Reset_Host_Name;
  106.     Sent_Host_Name = %TRUE;
  107.  
  108.     Wait_Time = 200;
  109.     if %StopAtHost = "1" goto Return_Success;
  110.     send %HostName & "^M";
  111.     if %StopAtHost = "" goto Connect_Wait;
  112.     goto Return_Success;
  113.  
  114. !
  115. ! Only send Host Name response on 1st, 3rd, & 5th attempts
  116. ! to guard against unintended double host name prompts resulting
  117. ! from sending "^M".  On even attempts, eat the Host Name: prompt.
  118. !
  119. Reset_Host_Name:
  120.     Sent_Host_Name = %FALSE;
  121.     Tries = Tries - 1;
  122.     goto Connect_Wait;
  123.  
  124. Send_ID:
  125.     define %State = 6;
  126.     if %StopAtHost = "1" goto GetHost;
  127.     define %ErrorCode = 0;
  128.     if %App = "CID" goto No_Msg1;
  129.     show "Logging onto CompuServe . .  ";
  130. No_Msg1:
  131.     if %MicroChallenge = "" goto No_Secure_Login;
  132.  
  133.     send Plus & %UserID & %LogonParams & "/INT:60 /secure:1^M";
  134.     Plus = "";
  135.     goto Connect_Wait;
  136.  
  137. No_Secure_Login:
  138.     send %UserID & %LogonParams & "/INT:60^M";
  139.     goto Connect_Wait;
  140.  
  141. GetHost:
  142.     send "/HOST^M";
  143.     exit %Success;
  144.  
  145. Send_Password:
  146.     define %State = 7;
  147.     if %MicroChallenge <> "" goto Secure_Failure;
  148.     send %Password & %CR;
  149.     goto Logon_Wait;
  150.  
  151. Secure_Failure:
  152.     define %FailureMsg = "Secure login failure, non-secure connect aborted";
  153.     define %ErrorCode = 37;
  154.     exit %Fatal;
  155.     
  156. Send_XPAD:
  157.     if %X121Address = "" goto Missing_XPAD;
  158.     send %X121Address & %CR;
  159.     goto Connect_Wait;
  160.  
  161. Missing_XPAD:
  162.     define %FailureMsg = "Missing X.121 address";
  163.     define %ErrorCode = 21;
  164.     exit %Fatal;
  165.     
  166. Logon_Wait:
  167.     wait
  168.         "Account ID:"   goto Send_AccountID,
  169.         "CompuServe"    goto Return_Success,
  170.         "^[[>"          goto Return_Success,
  171.         "^F"            goto Return_Success,
  172.                 "?"             goto Continue_Msg_Handle,
  173.         " NTW"          goto Logon_Failure,
  174.         "You are barred" goto Fail_External_Net,
  175.                 "You are not auth" goto Fail_External_Net,
  176.         "800 Direct Dial access " goto Process_800,
  177.         "OK^M"          goto Send_OK_Cmd,
  178.         "^[I"           goto Send_Response,
  179.         "PPP:"          goto Connect_PPP,
  180.         %mdm_Failure    goto CIS_No_Carrier
  181.     until 300;
  182.  
  183.     define %ErrorCode = 22;
  184.     goto CIS_Failure;
  185.  
  186. Connect_PPP:
  187.     if %App <> "CID" goto Logon_Wait;
  188.     if %WaitForPPP = "0" goto PPPDone;
  189.     PPPTries = 2;
  190.  
  191. RetryPPP:
  192.     if PPPTries = 0 goto Send_ETX;
  193.  
  194.     wait
  195.         "Host Name:"    goto PPPRecover,
  196.         "~"             goto PPPDone,
  197.         %mdm_Failure    goto CIS_No_Carrier
  198.  
  199.     until 300;
  200.  
  201.     send "^C";
  202.     PPPTries = PPPTries - 1;
  203.     goto RetryPPP;
  204.  
  205. PPPDone:
  206.     define %PPP = "1";
  207.     exit %Success;
  208.  
  209. Continue_Msg_Handle:
  210.         wait
  211.                 " LOG"          goto Process_Log_Msg,
  212.                 "LOG"           goto Process_Log_Msg,
  213.                 "?LOG"          goto Process_Log_Msg,
  214.                 " IPX"          goto Process_IPX_Msg,                
  215.                 " ICD"          goto Process_Net_Msg,
  216.                 "?ICD"          goto Process_Net_Msg,
  217.                 "ICD"           goto Process_Net_Msg,
  218.         "CompuServe"    goto Return_Success,
  219.         "^[[>"          goto Return_Success,
  220.         "^F"            goto Return_Success,
  221.                 %mdm_Failure    goto CIS_No_Carrier
  222.  
  223.         until 40;
  224.     define %ErrorCode = 22;
  225.     goto CIS_Failure;
  226.         
  227.  
  228. Process_Log_Msg:
  229.     wait
  230.         "INE"   goto Bad_ID,
  231.         "ISX"   goto Bad_ID_Syntax,
  232.         "CAI"   goto Cannot_Auto_Irun,
  233.         "SIL"   goto System_Unavailable,
  234.         "SIU"   goto System_Unavailable,
  235.         "SNA"   goto System_Unavailable,
  236.         "STU"   goto Check_User_ID,
  237.         "INS"   goto Bad_ID_Syntax,
  238.         "UTL"   goto Too_Many_Users
  239.     until 50;
  240.  
  241.     FailStr = "Unable to connect to CompuServe host";
  242.     goto Scan_Error;
  243.  
  244. Process_IPX_Msg:
  245.     define %ErrorCode = 23;
  246.     FailStr = "InfoPlex is unavailable, try again later";
  247.     goto Scan_Error;
  248.  
  249. Process_Net_Msg:
  250.     define %GatewayFailure = 1;
  251.     define %ErrorCode = 31;
  252.     FailStr = "PPP connection failure, please try again";
  253.  
  254. Scan_Error:
  255.     wait
  256.         "^M"    goto Found_Error
  257.     until 15;
  258.  
  259.     goto Return_Fatal_Msg;
  260.  
  261. Found_Error:
  262.     if %Scanned = "" goto Return_Fatal_Msg;
  263.     FailStr = %Scanned;
  264.     goto Return_Fatal_Msg;
  265.  
  266. Send_AccountID:
  267.     send %AccountID & %CR;
  268.     goto Logon_Wait;
  269.  
  270. Too_Many_Users:
  271.     if Tries = 0 goto Users_Failure;
  272.     show "Simultaneous users exceeded, retrying...";
  273.     goto Start_Connect;
  274.  
  275. Users_Failure:
  276.     define %FailureMsg = "Simultaneous users exceeded";
  277.     define %ErrorCode = 29;
  278.     exit %Fatal;
  279.  
  280. Cannot_Auto_Irun:
  281.     define %FailureMsg = "Cannot Auto Irun HMI server";
  282.     exit %Fatal;
  283.  
  284. Bad_ID:
  285.     define %ErrorCode = 24;
  286.     FailStr = "Incorrect User ID or password";
  287.     goto Try_Again;
  288.  
  289. Bad_ID_Syntax:
  290.     define %ErrorCode = 25;
  291.     FailStr = "Incorrect User ID syntax";
  292.  
  293. Try_Again:
  294.     if not FirstTry goto CIS_Fatal;
  295.     send "^C";
  296.     FirstTry = %FALSE;
  297.  
  298.     wait
  299.         "User ID"       goto Send_ID,
  300.         %mdm_Failure    goto CIS_No_Carrier
  301.     until 140;
  302.  
  303.     goto CIS_Fatal;
  304.  
  305.  
  306. System_Unavailable:
  307.     define %ErrorCode = 23;
  308.     FailStr = "The system is unavailable, try again later";
  309.     goto Scan_Error;
  310.  
  311. Check_User_ID:
  312.     define %ErrorCode = 26;
  313.     define %FailureMsg = "The system is unavailable, check User ID";
  314.     exit %Fatal;
  315.  
  316. Fail_External_Net:
  317.     define %FailureMsg ="Access via this network or number is not allowed.";
  318.     exit %Fatal;
  319.  
  320. Process_800:
  321.     wait
  322.         "is not" goto No_800,
  323.         "rates" goto Access_Rates
  324.     until 25;
  325.     goto Logon_Wait;
  326.  
  327.  
  328. No_800:
  329.     define %FailureMsg = "800 Direct Dial access is not available on your account";
  330.     define %ErrorCode = 4;
  331.     exit %Fatal;
  332.  
  333. Access_Rates:
  334.     show "800 Direct Dial access rates now in effect";
  335.     goto Logon_Wait;
  336.  
  337.  
  338. Logon_Failure:
  339.     define %ErrorCode = 27;
  340.     FailStr = "Remote is busy or unavailable";
  341.     goto Scan_Error;
  342.  
  343. Send_OK_Cmd:
  344.     if %OKCmd = "" goto Logon_Wait;
  345.     send %OKCmd & %CR;
  346.     goto Logon_Wait;
  347.  
  348. Send_Response:
  349.     define %State = 8;
  350.     sendi %ESCIResponse;
  351.     exit %Success;
  352.  
  353. CIS_Error:
  354.     define %ErrorCode = 20;
  355. CIS_Failure:
  356.     if %Network <> Internet goto No_Retry;
  357.     if %ErrorCode = 34 goto No_Retry;
  358.     define %GatewayFailure = 1;
  359.  
  360. No_Retry:
  361.     if FailStr <> "" goto Return_Fail_Msg;
  362.     define %FailureMsg = "Unable to connect to CompuServe host";
  363.     exit %Failure;
  364.  
  365. CIS_No_Carrier:
  366.     define %ErrorCode = 28;
  367.     if FailStr <> "" goto Return_Fail_Msg;
  368.     define %FailureMsg = "Modem connection lost";
  369.     exit %Failure;
  370.  
  371. CIS_Fatal:
  372.     if FailStr <> "" goto Return_Fatal_Msg;
  373.     define %FailureMsg = "Unable to connect to CompuServe host";
  374.     exit %Fatal;
  375.  
  376. Return_Fail_Msg:
  377.     define %FailureMsg = FailStr;
  378.     exit %Failure;
  379.  
  380. Return_Fatal_Msg:
  381.     define %FailureMsg = FailStr;
  382.     exit %Fatal;
  383.  
  384. Return_Success:
  385.     define %State = 8;
  386.     exit %Success;
  387.  
  388. Return_Cancel:
  389.     exit %Cancel;
  390.  
  391.  
  392. Handle_Secure_Login:
  393.     if %MicroChallenge = "" goto Connect_Wait;
  394.  
  395.     call %Dir & "seclog.scr" () : FailCode;
  396.  
  397.     if FailCode = 0 goto Logon_Wait;
  398.     if FailCode = 1 goto Return_Cancel;
  399.     if FailCode = 3 goto CIS_No_Carrier;
  400.  
  401.     ! Failure condition.
  402.     FailStr = %SecFailTemp;
  403.     SecureTries = SecureTries - 1;
  404.     if SecureTries = 0 goto CIS_Failure;
  405.  
  406.     show %SecFailTemp & ", retrying...";
  407.     goto Start_Connect;
  408.